<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 改变2个变量的值 互换
        let str = '老王';
        let str2 = "小李";

        // es5
        // 借助第三个变量
        // let _str = str; //老王
        // str = str2;
        // str2 = _str;
        // console.log(str,str2);

        // ES6
        [str2,str] = [str,str2];

        // str =小李
        // str2 = 老王
        console.log(str,str2);

    </script>
</body>
</html>